<?php 
  require_once dirname(__FILE__) . '/includes/common.inc.php';
  require_once dirname(__FILE__) . '/includes/pdoorm.inc.php';

  if(isset($_REQUEST['_action']) || $_REQUEST['_action']=='logout' )
  {
  	session_destroy();
  	
  	 //header("Location: http://192.168.1.88/wedding/clients.php");
  	 header("Location: http://dreamlife.net.au/wedding/clients.php");
  	
  }
  
 

  
  
  $customerno = $_POST['number'];
  $password =$_POST['pwd'];
  
  //$sql="select * from ns_v1customer where e_oid ='".$customerno."' and password = '".$password."' limit 1";
    $sql="select * from ns_v1customer where e_oid ='".$customerno."' and password = '".$password."'  AND cancelled = 0 
  and e_oid in (SELECT  DISTINCT customerId FROM ns_v1myorder WHERE customerId = '".$customerno."' AND disposalstatus = 0) limit 1";
  //echo $sql;
  $customerinfo = getone($sql,1);
  
  if(empty($customerinfo))
  {
  	 header("Location: http://dreamlife.net.au/wedding/clients.php");
	 //header("Location: http://192.168.1.88/wedding/clients.php");
  }else{
  	$_SESSION['pwd'] = $password;
  	
  }
  
  if(!isset($_SESSION['pwd']) || empty($_SESSION['pwd']) )
  {
  	  header("Location: http://dreamlife.net.au/wedding/clients.php");
	 //header("Location: http://192.168.1.88/wedding/clients.php");
  }   
  
  /*if(isset($_SESSION['pwd']) || !empty($_SESSION['pwd']) )
  {
  	echo $_SESSION['pwd'];
  }
  */

  

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>Customer</title>
  <style>
  body{
   margin:0px;
   font-family:Arial;
   font-size:13px;
   
   background-image: url(images/image/bk.png);
  }
  img{
   border:0px;
  }
  .content{
     width:1024px;
     margin-left:auto;
     margin-right:auto;
  }
  
  .divleft{
     float:left;
  }
  .baise{
     color:#4493BE;
     font-weight:bold;
     font-size:16px;
  }
  .white{
    color:#fff;
    font-weight:bold;
  }
  .huise{
    color:#AFAFAF;
    font-weight:bold;
  }  
  
  .copyright{
    color:#444444;
    font-size:12px;
    font-weight:bold;
    
  }
  .cusno{
     color:#fff;
     font-weight:bold;
  }
  .custable{
     width:845px;
     background:#fff;
     margin-top:-2px;
     
  }
  .cusinfo{
    width:845px;
    background-image: url(images/image/top-bk.png);
    background-repeat: repeat-x;
  }
  .cusinfobuttom{
    width:845px;
    background-image: url(images/image/bottom-bk.png);
    background-repeat: repeat-x;
  }
  .fenge{
    width:845px;
    background-image: url(images/image/dotted-line.png);
    background-repeat: repeat-x;   
  }
  .p40{
    padding-left:40px;
  }
  .pr40
  {
    padding-right:40px;
  }
  .pl15{
    padding-left:15px;
  }

 .h23{
    height:23px;
 }
 
 .h26{
    height:26px;
 }
  .h35{
    height:35px;
 }  
 .p-2{
   margin-left:-4px;
   margin-bottom:-2px;
 } 
  
  .tdtitle{
    color:#F49699;
  }
  .tdtitle1{
    color:#5FC3C2;
  }
  .tdtitle2{
    color:#265664;
  }
  .tdtitle3{
    color:#7dc1e4;/*#517885;/*#B3DAEF*/;
  }
  .tdtitle4
  {
     color:#0c4252;
  }
  

  .buttom{
     margin-top:-2px;
     margin-left:-3px;
  }
  .top{
     margin-left:-3px;
  }
  .help{
    margin-top:150px;
    margin-left:-1px;
    /*left:0px;*/
  }
  .helppng{
    /*position: absolute;*/
    position:fixed;
    left:0px;
  }
  .logo{
    margin-top:40px;
  }
  
  .tltable{
    border:solid 1px #DDEFF9;
    border-collapse:collapse;  
  }
  .tltd{
    height:40px;
    border:1px solid #DDEFF9;
  }
  .tltd1{
    border-right:10px solid #DDEFF9;
  }
  .tltr{
    background:#77cee6;/*#78CEE7;*/
    Z-index:9999999;
  }
  .footpng{
    float:right;
    margin-top:-55px;
    margin-right:-30px;
  }
  .print{
     margin-top:-4px;
  }
  .acenter{
    text-align:center;
  }
  .fontb{
     font-weight:bold;
  }
  .fontl{
     font-weight:900;
  }
  .m22{
    margin-top:22px;
  }
  .dis{
    display:none;
  }
   .mleft{
     margin-left:17px;
   }
  .logse{color:#923554;}
  .welc{color:#919191;}
  .bright{border-right:solid 2px #8F8F8F;}
  .unline{text-decoration:none;}
  </style>
  <script type="text/javascript" src="./jquery-1.7.1.min.js"></script>
  <script type="text/javascript" src="images/customer/popup_new.js"></script>
  
  <script type="text/javascript">
  $(function(){
	  $.ajax({
			type:'POST',
			url:'customer_info.php',
			data:'id=<?php echo $customerno;?>',
			dataType: "json",
			success:function(data){
				 //$("#pid2 ").empty();
				 //$("#pid2").append(data);
				//console.log(data.data);
				 showdata(data.data[0]);

				 //initFloatTips();
				}		
			}); 

	  initFloatTips();
	  
	  });

 function showdata(data)
  {
       //console.log(data);
       //$("bridename").html();
       //console.log(data.bridename);
       var customersname = (data.bridename == null ? '' : (data.bridename).toUpperCase()) + '  ' + (data.groomname == null ? '' : (data.groomname).toUpperCase());
       
       document.getElementById('cusname').appendChild(document.createTextNode(customersname));

       
       document.getElementById('bridename').appendChild(document.createTextNode(data.bridename == null ? '' : data.bridename));
       document.getElementById('bridephone').appendChild(document.createTextNode(data.bridephone == null ? '' : data.bridephone));
       document.getElementById('bridemobile').appendChild(document.createTextNode(data.bridemobile == null ? '' : data.bridemobile));
       document.getElementById('brideemail').appendChild(document.createTextNode(data.brideemail == null ? '' : data.brideemail));
       document.getElementById('bridead1').appendChild(document.createTextNode(data.brideaddrLn1 == null ? '' : data.brideaddrLn1));
       document.getElementById('bridead2').appendChild(document.createTextNode(data.brideaddrLn2 == null ? '' : data.brideaddrLn2));
       document.getElementById('bridead3').appendChild(document.createTextNode(data.brideaddrLn3 == null ? '' : data.brideaddrLn3));
       document.getElementById('bridead4').appendChild(document.createTextNode(data.brideaddrLn4 == null ? '' : data.brideaddrLn4));
       
       //document.getElementById('groomname').appendChild(document.createTextNode(data.groomname));
       document.getElementById('groomname').appendChild(document.createTextNode(data.groomname == null ? '' : data.groomname));
       document.getElementById('groomphone').appendChild(document.createTextNode(data.groomphone == null ? '' : data.groomphone));
       document.getElementById('groommobile').appendChild(document.createTextNode(data.groommobile == null ? '' : data.groommobile));
       document.getElementById('groomemail').appendChild(document.createTextNode(data.groomemail == null ? '' : data.groomemail));
       document.getElementById('groomad1').appendChild(document.createTextNode(data.groomaddrLn1 == null ? '' : data.groomaddrLn1));
       document.getElementById('groomad2').appendChild(document.createTextNode(data.groomaddrLn2 == null ? '' : data.groomaddrLn2));
       document.getElementById('groomad3').appendChild(document.createTextNode(data.groomaddrLn3 == null ? '' : data.groomaddrLn3));
       document.getElementById('groomad4').appendChild(document.createTextNode(data.groomaddrLn4 == null ? '' : data.groomaddrLn4));

       //console.log(data.orders);
         
		 var iii = 0;
       for(var i = 0 ,j = data.orders.length; i < j ; i++)
       { 
               var order = data.orders[i];
               var otype1 = (order.type).toLowerCase();
               var oflag = (order.flag).toLowerCase();
         
               if(order.disposalstatus == 1)
               {
                  continue;
               }else{
			     iii++;
			   }
			   
		       tr = document.getElementById('ordertype').insertRow(-1);//行
		       td = tr.insertCell(-1);
		        
		       var a = document.createElement('a');
		           a.href = "#";
		           a._order = order;
		           a.onclick = function (){
		               var otype1 = (this._order.type).toLowerCase();
					   var of1 = (this._order.flag).toLowerCase();
		                  var img1 = this.getElementsByTagName("img")[0];
		                   
		                   //img1.alt = '2';
		                   //console.log(img1);
		        	       sethighligt(this,otype1,of1);
		        	       showproducts(this._order);
		        	       showpayments(this._order);
		        	       showproduce(this._order);
		        	       showwd(this._order);
		               };

		               
		        td.appendChild(a);
		               
		        var img = document.createElement('img');
		            img.className = 'm22';
		            img.id=oflag;
                    //img._otype = otype1;
					img.alt = otype1;
		            
		            if(iii==1)
		            {
		            	img.src="images/image/"+otype1+"-highlight.png";
		            	
			        }else{
			        	img.src="images/image/"+otype1+".png"; 
			        	       
			        }

		            
		        a.appendChild(img);

		   if(iii == 1) {
			   showproducts(order);
			   showpayments(order);
			   showproduce(order);
			   showwd(order);
		   }
		        
       }
       
  }

 function showproducts(order)
 {
	 $('#products').html("");
	 for(var i = 0, j = order.products.length; i < j;i++)
	 {
		 var p = order.products[i];

		 if(p.cancelled == 1 ) continue;
		 
		 tr = document.getElementById('products').insertRow(-1);//行
		 tr.className = 'h26';
		 tr.style.backgroundColor = (tr.rowIndex % 2 != 0) ? '#DEF2F9' : '#fff';
		 
		 td = tr.insertCell(-1);
		 td.className = 'tdtitle2 acenter';
		 td.width = '55px';
		 td.appendChild(document.createTextNode(p.quantity));


		 td = tr.insertCell(-1);
		 td.className = 'tdtitle2 pl15';
		 td.width = '335px';
		 td.appendChild(document.createTextNode(p.name));

		 td = tr.insertCell(-1);
		 td.className = 'tdtitle2 pl15';
		 td.width = '365px';
		 td.appendChild(document.createTextNode( (p.modeltitle == null ? '' : p.modeltitle)  ));		 
     }
   
 }
  
 function showpayments(order)
 {
	 $('#subtotal').html("");
	 $('#subreceived').html("");
	 $('#subanti').html("");
	 $('#showpayment').html("");

	 var otype1 = (order.type).toLowerCase();
	 var total =parseFloat(order.price*(parseFloat(1 + parseFloat('<?php echo GST;?>'), 10))).toFixed(2);

	 document.getElementById('subtotal').appendChild(document.createTextNode('$'+total +'(Inc.GST)'));

	 var sumrec = 0,stage = 0,itotal1 = 0,itotal2 = 0,itotal3 = 0,itotal4 = 0;
	 for(var i = 0, j = order.payments.length; i < j;i++)
	 {
		 var pay = order.payments[i];

		 if(pay.cancelled == 1) continue;

		 sumrec += parseFloat(pay.amount);
		 
	      if (pay.stage == 1) itotal1 += parseFloat(pay.amount, 10);
	      if (pay.stage == 2) itotal2 += parseFloat(pay.amount, 10);
	      if (pay.stage == 3) itotal3 += parseFloat(pay.amount, 10);
	      if (pay.stage == 4) itotal4 += parseFloat(pay.amount, 10);
	      
	      stage = Math.max(stage, pay.stage);
	 }
	 
	  var anti = parseFloat(parseFloat(total - parseFloat(sumrec) )).toFixed(2);

	 document.getElementById('subreceived').appendChild(document.createTextNode('$'+parseFloat(sumrec).toFixed(2)));
	 document.getElementById('subanti').appendChild(document.createTextNode('$'+anti));

	 var rule =  payment(otype1);

	 //console.log(rule.length);
	 
	 for(var i = 1, j = rule.length; i <= j;i++)
	 {
		 var ru = rule[i-1];
		 tr = document.getElementById('showpayment').insertRow(-1);//行
		 tr.className = 'h26';
		 tr.style.backgroundColor = (tr.rowIndex % 2 != 0) ? '#DEF2F9' : '#fff';

		 td = tr.insertCell(-1);
		 td.className = 'tdtitle2 pl15';
		    
		 if(i == 1) 
		 {
		    td.appendChild(document.createTextNode('Deposit (Non-Refundable)'));
		    var itotal = itotal1;
		 }else{
			if(i == 2)
			{
				var fsup = 'nd';
				var itotal = itotal2;
			}else if(i == 3){
				var fsup = 'rd';
				var itotal = itotal3;
			}else if(i == 4){
				var fsup = 'th';
				var itotal = itotal4;
			}

            var sup = document.createElement('sup');
            sup.appendChild(document.createTextNode(fsup));
			
		    td.appendChild(document.createTextNode(i));
		    td.appendChild(sup);
		    td.appendChild(document.createTextNode('  payment'));
		 }

		 var syscaln = parseFloat(order.price* ru.rate).toFixed(2);
		 var syscal = parseFloat(total* ru.perc).toFixed(2);
		 var nopay = parseFloat(syscal-itotal ).toFixed(2);

		 var sumynopay = parseFloat(syscaln-sumrec).toFixed(2)
		 
		 var nop =  sumynopay > 0 ? nopay : '0.00'; 
		 
		 td = tr.insertCell(-1);
		 td.className = 'tdtitle2 pl15';
		 td.appendChild(document.createTextNode('$'+syscal+'(inc.GST)'+ru.title));


         
		 
		 td = tr.insertCell(-1);
		 td.className = 'tdtitle2 pl15';
		 td.appendChild(document.createTextNode('$'+ nop +'(inc.GST)'));



		  var table = document.createElement('table');
		  table.cellPadding = 0;
		  table.cellSpacing = 0;
		  
		  td = tr.insertCell(-1);
	      td.className = 'tdtitle2 pl15';
		  td.appendChild(table);	
		  
		 
		  for (var ii = 0, il = order.payments.length; ii < il; ii++) 
		  {
			    var p = order.payments[ii];
			    if (p.stage != i || p.cancelled == 1) {
			      continue;
			    }
			    
			    tr1 = table.insertRow(-1);
			    td1 = tr1.insertCell(-1);
			    //td.style.height = '15px';
			    //td.style.verticalAlign = 'middle';
			    td1.align = 'left';
			    td1.appendChild(document.createTextNode('$' + p.amount + ' '));
			    
			    
			    td1 = tr1.insertCell(-1);
			    td1.style.padding = '0px 4px';
			    td1.appendChild(document.createTextNode('paid on'));
			    td1 = tr1.insertCell(-1);
			    /*var datef = <?php //echo SimpleDate::toUTC(p.date); ?>;*/
			    td1.appendChild(document.createTextNode(' ' +SimpleDate.format(p.date) ));
		  }  

	 	 
	
	 }

	 tr = document.getElementById('showpayment').insertRow(-1);//行
	 tr.className = 'h26';
	 tr.style.backgroundColor = (tr.rowIndex % 2 != 0) ? '#DEF2F9' : '#fff';

	 td = tr.insertCell(-1);
	 td.className = 'tdtitle2 pl15';
	 td.appendChild(document.createTextNode('Your next payment due'));

	    if (rule[stage]) {
		      var due = parseFloat(total*rule[stage].rate - sumrec).toFixed(2);
	      } else {
	    	  var due = parseFloat(total - sumrec).toFixed(2);
	      }
	 
	 td = tr.insertCell(-1);
	 td.className = 'tdtitle2 pl15';
	 td.appendChild(document.createTextNode('$'+(due > 0 ? due : '0.00')+'(inc.GST)'));

	 td = tr.insertCell(-1);
	 td.className = 'tdtitle2 pl15';
	 td.appendChild(document.createTextNode(''));

	 td = tr.insertCell(-1);
	 td.className = 'tdtitle2 pl15';
	 td.appendChild(document.createTextNode(''));	 	 	 
   
 }

function showproduce(order)
{
	 $('#produce').html("");

	 if(order.produce.length == 0)
	 {
	   tr = document.getElementById('produce').insertRow(-1);//行
	   tr.className = 'tltd';
	   tr.style.borderTop = 'none';
	   //tr.style.backgroundColor = (tr.rowIndex % 2 != 0) ? '#DEF2F9' : '#fff';


		 td = tr.insertCell(-1);
		 td.className = 'tdtitle3 p40 tltd1';
		 td.colSpan = 3;
		 td.width = '20%';
		 td.appendChild(document.createTextNode(''));

		 td = tr.insertCell(-1);
		 td.className = 'tdtitle3 p40';
		 td.appendChild(document.createTextNode(''));		 
	 }

	 for(var i = 0,j = order.produce.length ; i < j; i++)
	 {
		   var pe = order.produce[i];
		   
		   tr = document.getElementById('produce').insertRow(-1);//行
		   tr.className = 'tltd';
		   if(i == 0)  tr.style.borderTop = 'none';
		   if(i == (j-1)) tr.style.borderBottom = 'none';

		   
		   td = tr.insertCell(-1);
		   td.colSpan = 3;
		   td.width = '20%';
		   
		   if(pe.is_curr == 'N'){
		       td.className = 'tdtitle3 p40 tltd1';
		       td.appendChild(document.createTextNode(SimpleDate.format(pe.date)));
		   }else{
			   td.className = 'white p40';

			   var div = document.createElement('div');
			       div.className = 'footpng';

			   var img = document.createElement('img'); 
			       img.src="images/image/foot.png";

			   div.appendChild(img);
			       
			   td.appendChild(document.createTextNode(SimpleDate.format(pe.date)));
			   td.appendChild(div);   
		   }
		   

		   td = tr.insertCell(-1);
		   td.className = 'tdtitle3 p40';
		   if(pe.title == 'DESIGNING STARTED DATE (CLICK HERE TO VIEW)')
		   {
			   var a = document.createElement('a');
	           a.href = "#products";
	           a.appendChild(document.createTextNode(pe.title));
	           td.appendChild(a);
			   
		   }else{
		       td.appendChild(document.createTextNode(pe.title));	
		   }	   
		   		 
	 }

}

function showwd(order)
{
	$('#wdtitle').html("");
	$('#wd').html("");
	
	var otype1 = (order.type).toLowerCase();

	if(otype1 == 'wedding')
	{
		document.getElementById('wdtitle').appendChild(document.createTextNode('Wedding Day'));
	}else{
		document.getElementById('wdtitle').appendChild(document.createTextNode('Shooting Day'));
	}

	document.getElementById('wd').appendChild(document.createTextNode(SimpleDate.format(order.date)));
}
 

 function payment(type)
 {
	 if(type == 'wedding')
	 {
		 return [ { rate: '<?php echo WEDDING_PAYMENT_RATE1;?>', perc: '<?php echo WEDDING_PAYMENT_PERC1;?>', title: '<?php echo WEDDING_PAYMENT_TITLE1;?>', comment: '<?php echo WEDDING_PAYMENT_COMMENT1;?>'},
		          { rate: '<?php echo WEDDING_PAYMENT_RATE2;?>', perc: '<?php echo WEDDING_PAYMENT_PERC2;?>', title: '<?php echo WEDDING_PAYMENT_TITLE2;?>', comment: '<?php echo WEDDING_PAYMENT_COMMENT2;?>'},
		          { rate: '<?php echo WEDDING_PAYMENT_RATE3;?>', perc: '<?php echo WEDDING_PAYMENT_PERC3;?>', title: '<?php echo WEDDING_PAYMENT_TITLE3;?>', comment: '<?php echo WEDDING_PAYMENT_COMMENT3;?>'},
		          { rate: '<?php echo WEDDING_PAYMENT_RATE4;?>', perc: '<?php echo WEDDING_PAYMENT_PERC4;?>', title: '<?php echo WEDDING_PAYMENT_TITLE4;?>', comment: '<?php echo WEDDING_PAYMENT_COMMENT4;?>'}
		        ];
	 }else if(type == 'prewedding'){
			 return [ { rate: '<?php echo PREWEDDING_PAYMENT_RATE1;?>', perc: '<?php echo PREWEDDING_PAYMENT_PERC1;?>', title: '<?php echo PREWEDDING_PAYMENT_TITLE1;?>', comment: '<?php echo PREWEDDING_PAYMENT_COMMENT1;?>'},
			          { rate: '<?php echo PREWEDDING_PAYMENT_RATE2;?>', perc: '<?php echo PREWEDDING_PAYMENT_PERC2;?>', title: '<?php echo PREWEDDING_PAYMENT_TITLE2;?>', comment: '<?php echo PREWEDDING_PAYMENT_COMMENT2;?>'}
			        ];
	 }else if(type == 'engagement'){
			 return [ { rate: '<?php echo ENGAGEMENT_PAYMENT_RATE1;?>', perc: '<?php echo ENGAGEMENT_PAYMENT_PERC1;?>', title: '<?php echo ENGAGEMENT_PAYMENT_TITLE1;?>', comment: '<?php echo ENGAGEMENT_PAYMENT_COMMENT1;?>'},
			          { rate: '<?php echo ENGAGEMENT_PAYMENT_RATE2;?>', perc: '<?php echo ENGAGEMENT_PAYMENT_PERC2;?>', title: '<?php echo ENGAGEMENT_PAYMENT_TITLE2;?>', comment: '<?php echo ENGAGEMENT_PAYMENT_COMMENT2;?>'}
			        ];
	 }else if(type == 'portrait'){
			 return [ { rate: '<?php echo PORTRAIT_PAYMENT_RATE1;?>', perc: '<?php echo PORTRAIT_PAYMENT_PERC1;?>', title: '<?php echo PORTRAIT_PAYMENT_TITLE1;?>', comment: '<?php echo PORTRAIT_PAYMENT_COMMENT1;?>'},
			          { rate: '<?php echo PORTRAIT_PAYMENT_RATE2;?>', perc: '<?php echo PORTRAIT_PAYMENT_PERC2;?>', title: '<?php echo PORTRAIT_PAYMENT_TITLE2;?>', comment: '<?php echo PORTRAIT_PAYMENT_COMMENT2;?>'}
			        ];
	}else if(type == 'other'){
			 return [ { rate: '<?php echo OTHER_PAYMENT_RATE1;?>', perc: '<?php echo OTHER_PAYMENT_PERC1;?>', title: '<?php echo OTHER_PAYMENT_TITLE1;?>', comment: '<?php echo OTHER_PAYMENT_COMMENT1;?>'}
			        ];
	}

 }

 function SimpleDate() {
 };
 
 SimpleDate.fmtDigits = function(num) {
	  num = parseInt(num, 10);
	  return (num < 10) ? ('0' + num) : num;
	};
	
	SimpleDate.format = function(sd, showTime) {
		  if (!sd) {
		    return 'Unknown';
		  }
		  if (!showTime) {
		    return SimpleDate.fmtDigits(sd.date) + '/' + SimpleDate.fmtDigits(sd.month) + '/' + sd.year;
		  }
		  return SimpleDate.fmtDigits(sd.hours) + ':' + SimpleDate.fmtDigits(sd.minutes) + ',' + SimpleDate.fmtDigits(sd.date) + '/' + SimpleDate.fmtDigits(sd.month) + '/' + sd.year;
		};	 

 function initr(){ //页面所有元素加载完毕
   /* var item  =  document.getElementById("tb");            //获取id为tb的元素(table)
    var tbody =  item.getElementsByTagName("tbody")[1];    //获取表格的第一个tbody元素
    var trs =   tbody.getElementsByTagName("tr");            //获取tbody元素下的所有tr元素
    
    for(var i = 0;i < trs.length;i++){//循环tr元素
        if(i%2 == 0){        //取模. (取余数.比如 0%2=0 , 1%2=1 , 2%2=0 , 3%2=1)
            trs[i].style.backgroundColor = "#DEF2F9"; // 改变 符合条件的tr元素 的背景色.
        }
    }*/
    

   /* var item1  =  document.getElementById("payment");            //获取id为tb的元素(table)
    var tbody1 =  item1.getElementsByTagName("tbody")[1];    //获取表格的第一个tbody元素
    var trs1 =   tbody1.getElementsByTagName("tr");            //获取tbody元素下的所有tr元素

    for(var ii = 0;ii < trs1.length;ii++){//循环tr元素
        if(ii%2 == 0){        //取模. (取余数.比如 0%2=0 , 1%2=1 , 2%2=0 , 3%2=1)
            trs1[ii].style.backgroundColor = "#DEF2F9"; // 改变 符合条件的tr元素 的背景色.
        }
    }*/
 }

   function sethighligt(obj,otype,flag)
   {
	  $("img.m22").each(function(){
		  if(this.id == flag)
		  {
			 this.src = "images/image/"+ this.alt +"-highlight.png";
		  }else{
		     this.src = "images/image/"+ this.alt +".png"
		  }
       });
   }

	

   var tips; var theTop = 550/*这是默认高度*/; var old = theTop;
   function initFloatTips() {
     tips = document.getElementById('floathelp');
     moveTips();
   };
   function moveTips() {
     var tt=50;
     if (window.innerHeight) {
       pos = window.pageYOffset
     }else if (document.documentElement && document.documentElement.scrollTop) {
       pos = document.documentElement.scrollTop
     }else if (document.body) {
       pos = document.body.scrollTop;
     }
     pos=pos-tips.offsetTop+theTop;
     pos=tips.offsetTop+pos/10;
     if (pos < theTop) pos = theTop;
     if (pos != old) {
       tips.style.top = pos+"px";
       tt=10;
     }
     old = pos;
     setTimeout(moveTips,tt);
   }

   //window.onload =  initFloatTips;   
   
	 function popupMethod2LeavePage() {
		  var _self = this;
		  var div = document.createElement('div');
		  var pop = new ModulePopupImage();
		  var size = _xDocSize();
		  var pos = [(size.w-600) / 2, (size.h-800) / 2];
		  pop._open(div, {
		    document: document,
		    pos : pos,
		    width : 380,
		    height : 230
		  });

		  var table = document.createElement('table');
		  table.cellPadding=0;
		  table.cellSpacing=0;
		  table.style.width = '375px';
		  table.style.height = '223px';
		  div.appendChild(table);

		  var tr = table.insertRow(-1);
		  var td = tr.insertCell(-1);
		  td.style.textAlign = 'left';
		  td.style.verticalAlign = 'bottom';
		  td.style.height = '20px';
		  td.style.paddingBottom = '5px';
		  td.style.fontFamily = 'Arial';
		  td.style.fontSize = '17px';
		  td.style.fontWeight = '400';
		  td.style.lineHeight = '20px';
		  td.style.color = '#e5e5e5';
		  
		  var ite = document.createElement('table');
		  ite.cellPadding=0;
		  ite.cellSpacing=0;
		  ite.width='100%';
		  ite.border = 0;
		  //ite.style.marginTop = '25px';	  
		  
		  td.appendChild(ite);

		  /*var iclose = document.createElement('div');
	          iclose.
		  td.appendChild(itable);	*/  
		  
		  var itr = ite.insertRow(-1);
		  itd = itr.insertCell(-1);
		  itd.style.paddingLeft = '30px';
		  itd.appendChild(document.createTextNode('CHANGE PASSWORD'));
		  
		  itd = itr.insertCell(-1);
		  itd.style.textAlign = 'center';
		  var del = document.createElement('img');
		  del.src = 'images/customer/delete.png';
		  del.style.cursor = 'pointer';
		  del.onclick = function() { 
		    pop._close(); 
		    _self._uploading = false;
		  };
		  itd.appendChild(del);
		  
		  
		  
		  tr = table.insertRow(-1);
		  td = tr.insertCell(-1);
		  td.style.height = "30px";
		  td.style.borderTop = 'solid 1px #434343';

		  tr = table.insertRow(-1);
		  td = tr.insertCell(-1);
		  td.style.textAlign = 'left';
		  td.style.verticalAlign = 'top';
		  td.style.height = '45px';
		  td.style.fontFamily = 'Arial';
		  td.style.fontSize = '13px';
		  td.style.fontWeight = '500';
		  td.style.color = '#bfbfbf';
		  //td.innerHTML = '<span>Are you sure you want to navigate away form this page?</span>';
		  
		  
		  var ita = document.createElement('table');
		  ita.cellPadding=0;
		  ita.cellSpacing=0;
		  //ita.border=1;
		  ita.style.width = '96%';
		  //ita.style.marginTop = '25px';
		  td.appendChild(ita);
		  
		  var itr = ita.insertRow(-1);
		  itd = itr.insertCell(-1);
		  itd.style.height = "30px";
		  itd.style.fontFamily = 'Arial';
		  itd.style.paddingLeft = '30px';
		  itd.style.fontSize = '12px';
		  itd.style.color = '#a7345e';
		  itd.colSpan = 2;
		  itd.id = 'msgbox';
		  
		  //itd.appendChild(document.createTextNode('The password must be 4 digits.'));
		  itd.appendChild(document.createTextNode(''));
		  
		  
		  var itr = ita.insertRow(-1);
		  itd = itr.insertCell(-1);
		  itd.style.height = "30px";
		  itd.style.fontFamily = 'Arial';
		  itd.style.paddingLeft = '30px';
		  itd.style.fontSize = '12px';
		  itd.style.color = '#7d7d7d';
		  
		  itd.appendChild(document.createTextNode('Old Password'));
		  
		  itd = itr.insertCell(-1);
		  itd.style.height = "30px";
		  itd.style.width = '160px';
		  itd.style.textAlign = 'center';
		  var inputo = document.createElement('input');
		      inputo.type = 'password';
		      inputo.id="oldp";
		  itd.appendChild(inputo);	  
		  
		  
		  var itr = ita.insertRow(-1);
		  itd = itr.insertCell(-1);
		  itd.style.height = "30px";
		  itd.style.fontFamily = 'Arial';
		  itd.style.paddingLeft = '30px';
		  itd.style.marginTop = '10px';
		  itd.style.fontSize = '12px';
		  itd.style.color = '#7d7d7d';	  
		  itd.appendChild(document.createTextNode('New Password'));
		  
		  itd = itr.insertCell(-1);
		  itd.style.width = '160px';
		  itd.style.height = "30px";
		  itd.style.textAlign = 'center';
		  
		  var inputo = document.createElement('input');
		      inputo.type = 'password';
		      inputo.id="newp";
		  itd.appendChild(inputo);	  
		  
		  
		  var itr = ita.insertRow(-1);
		  itd = itr.insertCell(-1);
		  itd.style.height = "30px";
		  itd.style.fontFamily = 'Arial';
		  itd.style.paddingLeft = '30px';
		  itd.style.marginTop = '10px';
		  itd.style.fontSize = '12px';
		  itd.style.color = '#7d7d7d';	  
		  itd.appendChild(document.createTextNode('Comfirm New Password'));
		  
		  itd = itr.insertCell(-1);
		  itd.style.width = '160px';
		  itd.style.height = "30px";
		  itd.style.textAlign = 'center';
		  var inputo = document.createElement('input');
		      inputo.type = 'password';
		      inputo.id="conp";
		  itd.appendChild(inputo);	  	  
		  
		  

		  
		  tr = table.insertRow(-1);
		  td = tr.insertCell(-1);
		  td.align = "right";
		  td.style.verticalAlign = 'top';
		  td.style.height = '90px';

		  var itable = document.createElement('table');
		  itable.cellPadding=0;
		  itable.cellSpacing=0;
		  itable.style.marginTop = '25px';
		  td.appendChild(itable);

		  var itr = itable.insertRow(-1);
		  itd = itr.insertCell(-1);
		  var ok = document.createElement('img');
		  ok.src = 'images/customer/save.png';
		  ok.style.cursor = 'pointer';
		  ok.style.marginRight = '10px';
		  ok.onclick = function() {
			  //changepass();
			  
			 var oldp = $("#oldp").val();
	 	     var newp = $("#newp").val();
	 	     var conp = $("#conp").val();

             if(oldp.length != 4 || newp.length != 4 || conp.length != 4)
             {
            	 $("#msgbox").html('');
                 $("#msgbox").html('The password must be 4 digits.');
                 return false;
             }else{
                 if(oldp.length == 4)
                 {
		           	  $.ajax({
		      			type:'POST',
		      			url:'customer_server.php',
		      			data:'id=<?php echo $customerno;?>&password='+ oldp +'&action=checkpwd',
		      			dataType: "json",
		      			success:function(data){
		     				 if(data == 2)
		     				 {
		     	            	 $("#msgbox").html('');
		     	                 $("#msgbox").html('The old password is error.');
		     	                 return false;        				 
		         			 }
		      			  }		
		      			});
                  }


                 if(newp != conp)
                 {
                	 $("#msgbox").html('');
                     $("#msgbox").html('New pasword ,Confirm pasword is not consistent.');                    
                 }else{
		           	  $.ajax({
			      			type:'POST',
			      			url:'customer_server.php',
			      			data:'id=<?php echo $customerno;?>&password='+ conp +'&action=updatepwd',
			      			dataType: "json",
			      			success:function(data){
			     				 if(data == conp)
			     				 {
			     					pop._close();     				 
			         			 }else{
			     	            	 $("#msgbox").html('');
			     	                 $("#msgbox").html('The old password is error.');
			     	                 return false;   
					         	 }
			      			  }		
			      			});                   
                 }

                  
             }

             
			  
			 //pop._close();
		   // var size = _xDocSize(document);
		   // var pos = [0, 0];
		    //popupLoading(popup_loading, pos);
		    
		    //_self._uploading = false;
		    
		     
		    //setUploadPageDiv(method, page);
		    //setUploadContentDiv(method, page);
		  };
		  itd.appendChild(ok);
		  
		  itd = itr.insertCell(-1);
		  var cancel = document.createElement('img');
		  cancel.src = 'images/customer/cancel.png';
		  cancel.style.cursor = 'pointer';
		  cancel.onclick = function() { 
		    pop._close(); 
		    _self._uploading = false;
		  };
		  itd.appendChild(cancel);
		  
		};	  
</script>
 </head>

 <body >
 <div class="content">

    <!-- menu -->
    <table align="right"  style="margin-top:-40px;"  border=0 width="50%">
      <tr>
         <td class='welc bright' style="margin-right:10px;" nowrap>WELCOME <span id="cusname"></span></td>
         <td class='logse bright' align="center" nowrap><a href="#" onclick="popupMethod2LeavePage();" class='unline'>CHANGE PASSWORD</a></td>
         <td  class='logse'  align="center"  nowrap><a href="customer.php?_action=logout" class='unline'>LOGOUT</a></td>
      </tr>
    </table>
    <!-- menu -->
    
    <!-- logo -->
    <table align="center" class="logo" border=0>
      <tr>
         <td><img src="images/image/logo.png"></td>
      </tr>
      <tr>
         <td><img src="images/image/logo-text.png"></td>
      </tr>
      <tr class="h23">
         <td>&nbsp;</td>
      </tr>
    </table>
    <!-- logo -->
    
    <!-- left -->
     <div class="divleft">
        <table>
         <tbody id="ordertype">
          <!--  <tr>
             <td><a href="#" onclick="sethighligt(this,'wedding');"><img id="wedding" src="images/image/wedding.png"></a></td>
          </tr>
          <tr>
             <td ><a href="#" onclick="sethighligt(this,'prewedding');"><img id="prewedding"  src="images/image/prewedding.png"  class="m22"></a></td>
          </tr>
          <tr>
             <td ><a href="#" onclick="sethighligt(this,'engagement');"><img id="engagement"  src="images/image/engagement.png"  class="m22"></a></td>
          </tr> 
          <tr>
             <td ><a href="#" onclick="sethighligt(this,'portrait');"><img id="portrait"  src="images/image/portrait.png"  class="m22"></a></td>
          </tr>
          <tr>
             <td ><a href="#" onclick="sethighligt(this,'other');"><img id="other"  src="images/image/other.png"  class="m22"></a></td>
          </tr>-->
         </tbody>                    
        </table>
        
        <!--help  -->
         <table class="help">
          <tr>
             <td ><div id="floathelp" class="helppng"><a href="http://dreamlife.net.au/wedding/contact.php" target="_blank"><img src="images/image/help.png" onmouseover="this.src ='images/image/help.png'" 
                  style="CURSOR: hand" onMouseOut="this.src ='images/image/help.png'"></a></div></td>
          </tr>
        </table>  
        <!--help  -->     
     </div>
    <!-- left -->
    
    <!-- right main -->
      <div  class="divleft mleft">
        <table class="p-2">
           <tr>
              <td class="baise">MY ACCOUNT <span class="cusno">#<?php echo customerno($customerno);?></span></td>
           </tr>
        </table>

        <table class="top">
           <tr >
              <td class="cusinfo"></td>
           </tr>
        </table>   
             
        <table class="custable">
           <tr>
              <td colspan="4" class="h35">&nbsp;</td>
           </tr>
           <tr  class="h23">
              <td class="tdtitle p40 fontb" width="100px">Bride Name</td>
              <td class="tdtitle2" id="bridename" width="323px"></td>
              <td class="tdtitle1 fontb"  width="100px">Groom Name</td>
              <td class="tdtitle2" id="groomname" width="322px"></td>
           </tr>
           <tr  class="h23">
              <td class="tdtitle p40 fontb">Phone</td>
              <td class="tdtitle2 " id="bridephone"></td>
              <td class="tdtitle1 fontb">Phone</td>
              <td class="tdtitle2 " id="groomphone"></td>
           </tr>
           <tr  class="h23">
              <td class="tdtitle p40 fontb">Mobile</td>
              <td class="tdtitle2 "  id="bridemobile"></td>
              <td class="tdtitle1 fontb">Mobile</td>
              <td class="tdtitle2 " id="groommobile"></td>
           </tr>
           <tr  class="h23">
              <td class="tdtitle p40 fontb">Email</td>
              <td class="tdtitle2 " id="brideemail"></td>
              <td class="tdtitle1 fontb">Email</td>
              <td class="tdtitle2 " id="groomemail"></td>
           </tr>                      
           <tr  class="h23">
              <td class="tdtitle p40 fontb">Street Address</td>
              <td class="tdtitle2 "  id="bridead1"></td>
              <td class="tdtitle1 fontb">Street Address</td>
              <td class="tdtitle2 "  id="groomad1"></td>
           </tr>
           <tr  class="h23">
              <td class="tdtitle p40 fontb">Suburb</td>
              <td class="tdtitle2 " id="bridead2"></td>
              <td class="tdtitle1 fontb">Suburb</td>
              <td class="tdtitle2 "  id="groomad2"></td>
           </tr>
           <tr  class="h23">
              <td class="tdtitle p40 fontb">State</td>
              <td class="tdtitle2 "  id="bridead3"></td>
              <td class="tdtitle1 fontb">State</td>
              <td class="tdtitle2 " id="groomad3"></td>
           </tr>
           <tr  class="h23">
              <td class="tdtitle p40 fontb">Post Code</td>
              <td class="tdtitle2 " id="bridead4"></td>
              <td class="tdtitle1 fontb">Post Code</td>
              <td class="tdtitle2 " id="groomad4"></td>
           </tr>  
           <tr>
              <td colspan="4">&nbsp;</td>
           </tr>
           <tr>
              <td class="fenge" colspan="4"></td>
           </tr>
           <tr>
              <td colspan="4">&nbsp;</td>
           </tr>           
           <tr>
              <td class="huise p40 fontb" id='wdtitle'></td>
              <td class="tdtitle2 fontl"  id="wd"></td>
              <td class="tdtitle1 fontb"></td>
              <td class="tdtitle2 "></td>
           </tr>
           <tr>
              <td colspan="4">&nbsp;</td>
           </tr>                        
           <tr>
              <td class="fenge" colspan="4"></td>
           </tr>
           <tr>
              <td colspan="4">&nbsp;</td>
           </tr>
           <tr>
              <td colspan="4">
                 <table  id="tb" class="p40 pr40">
                     <tr>
                        <td width="55px" class="huise acenter">Qty</td>
                        <td width="315px" class="huise pl15">Product</td>
                        <td width="385px"  class="huise acenter">Status</td>
                     </tr>
                     <tbody id='products' name ='products'>
                     <!--  <tr class="h26">
                        <td width="55px" class="tdtitle2 acenter">1</td>
                        <td width="315px" class="tdtitle2 pl15">Photo DVDs</td>
                        <td width="385px" class="tdtitle2 pl15">&nbsp;</td>
                     </tr>
                     <tr class="h26">
                        <td width="55px" class="tdtitle2 acenter">11</td>
                        <td width="315px" class="tdtitle2 pl15">Photo</td>
                        <td width="385px" class="tdtitle2 pl15">&nbsp;</td>
                     </tr>
                     <tr class="h26">
                        <td width="55px" class="tdtitle2 acenter">12</td>
                        <td width="315px" class="tdtitle2 pl15">DVDs</td>
                        <td width="385px" class="tdtitle2 pl15">&nbsp;</td>
                     </tr> --> 
                     </tbody>                   
                 </table>
              </td>
           </tr>  
           <tr>
              <td colspan="4" class="h35">&nbsp;</td>
           </tr>
        </table>
        
        <table class="buttom">
           <tr >
              <td class="cusinfobuttom"></td>
           </tr>
        </table>  
        
        <!-- payment -->
        <table class="p-2">
           <tr>
              <td class="baise">PAYMENT HISTORY</td>
           </tr>
        </table>

        <table class="top">
           <tr >
              <td class="cusinfo"></td>
           </tr>
        </table>   
             
        <table class="custable">
           <tr>
              <td colspan="4" class="h35">&nbsp;</td>
           </tr>
           <tr>
              <td colspan="3" class="huise p40" width="30%">SUB-Total Price </td>
              <td  class="tdtitle2 fontl" id="subtotal"></td>
           </tr>
           <tr>
              <td colspan="3" class="huise p40">SUB-Total Received </td>
              <td class="tdtitle2 fontl" id="subreceived"></td>
           </tr>
           <tr>
              <td colspan="3" class="huise p40">SUB-Total Anticipated </td>
              <td class="tdtitle2 fontl" id="subanti"></td>
           </tr> 
           <tr>
              <td colspan="4">&nbsp;</td>
           </tr>
           <tr>
              <td class="fenge" colspan="4"></td>
           </tr>
           <tr>
              <td colspan="4">&nbsp;</td>
           </tr>
           <tr>
              <td colspan="4">
                 <table id="payment" width="100%"  class="p40 pr40">
                     <tr>
                        <td>&nbsp;</td>
                        <td class="huise pl15">System Calculate</td>
                        <td class="huise pl15">Actual Residue</td>
                        <td class="huise pl15">Actual Paid</td>
                     </tr>
                     <tbody id="showpayment">
                     <!-- <tr  class="h26">
                        <td class="tdtitle2 pl15">Deposit (Non-Refundable)</td>
                        <td class="tdtitle2 pl15">$195.65 (inc.GST) (30%)</td>
                        <td class="tdtitle2 pl15">$195.65 (inc.GST)</td>
                        <td class="tdtitle2 pl15">&nbsp;</td>
                     </tr>
                     <tr class="h26" id="pay2">
                        <td class="tdtitle2 pl15">2<sup>nd</sup> Payment</td>
                        <td class="tdtitle2 pl15">$1322.83 (inc.GST) (20%)</td>
                        <td class="tdtitle2 pl15">$211.83 (inc.GST)</td>
                        <td class="tdtitle2 pl15">$1111.00 	paid on	06/09/2012</td>
                     </tr>
                     <tr class="h26"  id="pay3">
                        <td class="tdtitle2 pl15">3<sup>rd</sup> Payment</td>
                        <td class="tdtitle2 pl15">$1322.83 (inc.GST) (20%)</td>
                        <td class="tdtitle2 pl15">$211.83 (inc.GST)</td>
                        <td class="tdtitle2 pl15">$1111.00 	paid on	06/09/2012</td>
                     </tr>
                     <tr class="h26"  id="pay4">
                        <td class="tdtitle2 pl15">4<sup>th</sup>  Payment</td>
                        <td class="tdtitle2 pl15">$1322.83 (inc.GST) (20%)</td>
                        <td class="tdtitle2 pl15">$211.83 (inc.GST)</td>
                        <td class="tdtitle2 pl15">$1111.00 	paid on	06/09/2012</td>
                     </tr>                     
                     <tr class="h26"  id="npay">
                        <td class="tdtitle2 pl15">Your next payment due</td>
                        <td class="tdtitle2 pl15">$1322.83 (inc.GST)</td>
                        <td class="tdtitle2 pl15">&nbsp;</td>
                        <td class="tdtitle2 pl15">&nbsp;</td>
                     </tr>   -->
                     </tbody>
                 </table>
              </td>
           </tr>
           <tr>
              <td colspan="4" class="h35">&nbsp;</td>
           </tr>
        </table>
        
        <table class="buttom">
           <tr >
              <td class="cusinfobuttom"></td>
           </tr>
        </table>        
        
        <!-- payment --> 
        
        
        <!-- timeline -->
        <table  class="p-2">
           <tr>
              <td class="baise">TIMELINE</td>
           </tr>
        </table>

        <table class="top">
           <tr>
              <td class="cusinfo"></td>
           </tr>
        </table>   
             
        <table class="custable tltable" >
           <tr>
              <td colspan="3" class=" tltd1" style="border-top:none;">&nbsp;</td>
              <td style="border-top:none;">&nbsp;</td>
           </tr>
           <tbody id="produce">
           <!-- <tr class="tltd" style="border-top:none;">
              <td colspan="3"  width="20%" class="tdtitle3 p40 tltd1">2<sup>nd</sup> Aug 2012</td>
              <td  class="tdtitle3 p40">Order Date</td>
           </tr>
           <tr class="tltd">
              <td colspan="3" class="tdtitle3 p40 tltd1">2<sup>nd</sup>  Aug 2012</td>
              <td class="tdtitle3 p40">Shooting Date</td>
           </tr>
           <tr class="tltd">
              <td colspan="3"  class="tdtitle3 p40 tltd1">2<sup>nd</sup>  Aug 2012</td>
              <td class="tdtitle3 p40">Photo DVD Ready Date</td>
           </tr> 

           <tr class="tltd tltr">
              <td colspan="3"  width="20%" class="white p40 " nowrap>2<sup>nd</sup>  Aug 2012 <div  class="footpng"><img src="images/image/foot.png"></img></div></td>
              <td  class=" p40 white">Photo DVD Pick up Date</td>
           </tr>
           <tr class="tltd">
              <td colspan="3" class="tdtitle4 p40 tltd1">2<sup>nd</sup>  Aug 2012</td>
              <td class="tdtitle4 p40">Photo selection form received Date</td>
           </tr>
           <tr class="tltd">
              <td colspan="3"  class="tdtitle4 p40 tltd1">2<sup>nd</sup>  Aug 2012</td>
              <td class="tdtitle4 p40">Design Completed Date</td>
           </tr> 
           <tr class="tltd">
              <td colspan="3"  width="20%" class="tdtitle4 p40 tltd1">2<sup>nd</sup>  Aug 2012</td>
              <td  class="tdtitle4 p40">Modification Require Received Date</td>
           </tr>
           <tr class="tltd">
              <td colspan="3" class="tdtitle4 p40 tltd1">2<sup>nd</sup>  Aug 2012</td>
              <td class="tdtitle4 p40">Modification ComPleted Date</td>
           </tr>
           <tr class="tltd">
              <td colspan="3"  class="tdtitle4 p40 tltd1">2<sup>nd</sup>  Aug 2012</td>
              <td class="tdtitle4 p40">Design Confirmed Date</td>
           </tr> 
           <tr class="tltd"  style="border-bottom:none;">
              <td colspan="3"  class="tdtitle4 p40 tltd1">2<sup>nd</sup>  Aug 2012</td>
              <td class="tdtitle4 p40">Expected Collecting Date</td>
           </tr>  -->
           </tbody>
                                 
           <tr>
              <td colspan="3" class=" tltd1" style="border-bottom:none;">&nbsp;</td>
              <td  style="border-bottom:none;">&nbsp;</td>
           </tr>
        </table>
        
        <table class="buttom">
           <tr >
              <td class="cusinfobuttom"></td>
           </tr>
           <!-- <tr>
             <td><a href="#"><img src="images/image/print.png" class="print"></a></td>
           </tr> -->
           <tr>
             <td align="center" class="copyright"><div  style="margin-top:40px;margin-bottom:25px;">&copy2012 DREAMLIFE PHOTOS & VIDEO,all rights reserved.</div></td>
           </tr>
        </table>        
        
        <!-- timeline -->
                 
               
      </div>
    
    <!-- right main -->
 </div>
  
 </body>
</html>